home *** CD-ROM | disk | FTP | other *** search
/ Transactor / Transactor_18_1987_Transactor_Publishing.d64 / fac1 facts.pal (.txt) < prev    next >
Commodore BASIC  |  2023-02-26  |  2KB  |  91 lines

  1. 100 rem ***    fac1 facts    ***
  2. 110 rem *** by john houghton ***
  3. 120 rem *** collingwood  ont ***
  4. 130 rem ***   august  1986   ***
  5. 140 rem
  6. 150 rem pal source code
  7. 160 rem
  8. 170 sys700
  9. 180 ;
  10. 190 .opt oo
  11. 200 ;
  12. 210 *= $c000
  13. 220 ;
  14. 230 ;a routine to demonstrate the use
  15. 240 ;of floating point numbers, the
  16. 250 ;associated floating point
  17. 260 ;accumulators and rom routines.
  18. 270 ;
  19. 280 lda #$00
  20. 290 sta count       ;clear integer
  21. 300 sta count+1     ;storage
  22. 310 lda $7a         ;store chrget
  23. 320 sta getlo       ;pointers
  24. 330 lda $7b
  25. 340 sta gethi
  26. 350 lda #<buffr1    ;point chrget to
  27. 360 sta $7a         ;1st number
  28. 370 lda #>buffr1
  29. 380 sta $7b
  30. 390 jsr $0079       ;call chr(NULL)t
  31. 400 jsr $bcf3       ;ascii to fac1
  32. 410 jsr $bbca       ;fac1 to mem $57
  33. 420 lda #<buffr2    ;point chrget to
  34. 430 sta $7a         ;2nd number
  35. 440 lda #>buffr2
  36. 450 sta $7b
  37. 460 jsr $0079       ;call chr(NULL)t
  38. 470 jsr $bcf3       ;ascii to fac1
  39. 480 jsr $bbc7       ;fac1 to mem $5c
  40. 490 lda #$57
  41. 500 ldy #$00
  42. 510 jsr $ba28       ;$57 to fac2 & mult
  43. 520 jsr $bbca       ;product to $57
  44. 530 ;
  45. 540 add = *
  46. 550 lda #$5c
  47. 560 ldy #$00
  48. 570 jsr $bba2       ;$5c to fac1
  49. 580 ldx $61         ;exponent fac1
  50. 590 jsr $b86a       ;add fac2 to fac1
  51. 600 jsr $bc0f       ;sum to fac2
  52. 610 inc count       ;inc number of
  53. 620 bne nex         ;additions
  54. 630 inc count+1
  55. 640 ;
  56. 650 nex = *
  57. 660 lda #$57
  58. 670 ldy #$00
  59. 680 jsr $bc5b       ;compare sum & prod
  60. 690 bmi add         ;fac1 < $57
  61. 700 jsr $bddd       ;fac1 to ascii
  62. 710 jsr $ab1e       ;print sum
  63. 720 lda #$0d
  64. 730 jsr $ffd2
  65. 740 lda #$57
  66. 750 ldy #$00
  67. 760 jsr $bba2       ;$57 to fac1
  68. 770 jsr $bddd       ;fac1 to ascii
  69. 780 jsr $ab1e       ;print product
  70. 790 lda #$0d
  71. 800 jsr $ffd2
  72. 810 lda count+1     ;get count of
  73. 820 ldx count       ;additions convert
  74. 830 jsr $bdcd       ;int to ascii
  75. 840 jsr $ab1e       ;print count
  76. 850 lda getlo
  77. 860 sta $7a         ;restore chrget
  78. 870 lda gethi
  79. 880 sta $7b
  80. 890 rts
  81. 900 ;
  82. 910 count *= *+2
  83. 920 getlo *= *+1
  84. 930 gethi *= *+1
  85. 940 ;
  86. 950 buffr1 .asc "10.125"
  87. 960 .byte $00
  88. 970 ;
  89. 980 buffr2 .asc "6.375"
  90. 990 .byte $00
  91.